package cn.mw.cmdb.task;

import cn.mw.microMonitorCommon.api.scan.AssetScanService;
import cn.mw.microMonitorCommon.api.scan.StopParam;
import lombok.Data;

import java.util.concurrent.Future;

@Data
public class AssetScanServiceContext {
    private AssetScanService assetScanService;
    private Future future;
    private String taskId;

    public AssetScanServiceContext(AssetScanService assetScanService ,String taskId ,Future future){
        this.assetScanService = assetScanService;
        this.taskId = taskId;
        this.future = future;
    }

    public void stopService(){
        StopParam stopParam = new StopParam();
        stopParam.setTaskId(taskId);
        assetScanService.stopScan(stopParam);
        future.cancel(true);
    }
}
